Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests/numpy 2.0 #44

Merged
merged 10 commits into from
Jul 17, 2024
Merged

Tests/numpy 2.0 #44

merged 10 commits into from
Jul 17, 2024

Conversation

wx4stg
Copy link
Contributor

@wx4stg wx4stg commented Jul 2, 2024

Numpy appears to have changed what a percentile means with numpy 2.0, as well as maybe what it means to divide.
I added the following lines at the end of 'event_discharge_energy', right before the return statement, in pyxlma.lmalib.flash.properties

    print(zinit)
    print(-(zinit/8.4))
    print(np.exp(-(zinit/8.4)))
    print(np.percentile(z,73))
    print(np.percentile(z,27))
    print('--------')

I got the following results: https://www.diffchecker.com/lvlbQjU2/ (original is numpy 1.26.4, changed is 2.0.0). -zinit/8 is reported with less precision (maybe a dtypes thing) which trickles down into np.exp(-(zinit/8.4)) (fortunately numpy 2.0 does not change the value of Euler's number, as I had originally suspected), and same thing with the percentile values.

somehow specifying the DEFAULT VALUES rtol and atol kwargs to np.allclose fixes all of this? I don't understand anything anymore...

@codecov-commenter
Copy link

codecov-commenter commented Jul 2, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.13%. Comparing base (ed609f1) to head (8a28cf2).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #44   +/-   ##
=======================================
  Coverage   78.13%   78.13%           
=======================================
  Files          13       13           
  Lines        1866     1866           
=======================================
  Hits         1458     1458           
  Misses        408      408           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@deeplycloudy
Copy link
Owner

Reviewed in person today … looks good. Thanks for tracking down reasons for these changes. The numpy kwarg default on allclose apparently not changing but yet giving different results if not stated explicitly is perplexing and worrying, but this is a good fix for our needs.

@deeplycloudy deeplycloudy merged commit d7cbf87 into deeplycloudy:master Jul 17, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants